package file;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author guoqf
 * @date 2021/6/17 9:56
 */
public class JavaTriMetaSignalTest {
    public static void main(String[] args) {
//        boolean b1 = false;
//        boolean b2 = true;
//        System.out.println(b1 ? "b1 true" : b2 ? "b2 true" : "b2 false");
//        System.out.println(b1 ? "b1 true" : (b2 ? "b2 true" : "b2 false"));
//        System.out.println(b1 ? b2 ? "b1 true, b2 true" : "b1 true, b2 false" : "b1 false");
//        System.out.println(b1 ? (b2 ? "b1 true, b2 true" : "b1 true, b2 false") : "b1 false");

        AtomicInteger atomicInteger = new AtomicInteger();

        int len=1000;

        ConcurrentHashMap<Integer, Boolean> data = new ConcurrentHashMap<>(len);
        ExecutorService executorService = Executors.newFixedThreadPool(20);

        for (int i = 0; i < len; i++) {
            executorService.execute(()-> System.out.println(atomicInteger.incrementAndGet()));
        }

        try {
            Thread.sleep(5000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("atomicInteger: " + atomicInteger);


    }


}